import type { CloudFilterBarScheme } from '@/components/filter-bar/types'
import { buildColumns } from '@/utils'
export default function useTableColumn() {
  const filterSchemes = computed<CloudFilterBarScheme>(() => {
    return {
      widgets: [
        {
          widget: 'input',
          field: 'name_keyword',
          showIcon: true,
          placeholder: '请输入 DNS 账户名称'
        }
      ]
    }
  })
  const columns = computed(() =>
    buildColumns([
      {
        title: '账户名称',
        dataIndex: 'name'
      },
      {
        title: 'DNS 服务商',
        dataIndex: 'provider',
        render: ({ record }) =>
          getOptionsLabel(providerOptions, record.provider)
      },
      // {
      //   title: '秘钥',
      //   slotName: 'secret'
      // },

      {
        title: '添加时间',
        dataIndex: 'created_at',
        width: 180,

        format: 'date-time',
        sortable: sortableSettings
      },
      {
        title: '操作',
        width: 116,
        slotName: 'action',
        cellClass: 'actions-cell',
        fixed: 'right'
      }
    ])
  )
  return {
    columns,
    filterSchemes
  }
}
